package com.cb.admin.service.impl;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

import org.apache.log4j.Logger;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.cb.admin.domain.ResourceInfo;
import com.cb.admin.domain.WjwAppGj;
import com.cb.admin.domain.WjwGj;
import com.cb.admin.mapper.IResourceInfoMapper;
import com.cb.admin.mapper.IWjwAppGjMapper;
import com.cb.admin.mapper.IWjwGjMapper;
import com.cb.admin.service.IApiService;

@Service
public class ApiServiceImpl implements IApiService {
	
	private static Logger logger = Logger.getLogger(ApiServiceImpl.class.getName());
	
	@Autowired
	private IResourceInfoMapper resourceInfoMapper;
	@Autowired
	private IWjwGjMapper wjwGjMapper;
	@Autowired
	private IWjwAppGjMapper wjwAppGjMapper;

	@Override
	public Map queryXS(String startTime,String start,String length) {
		// TODO Auto-generated method stub
		ResourceInfo resourceInfo = new ResourceInfo();
		resourceInfo.setCreateAt(startTime);
		resourceInfo.setStart(Integer.parseInt(start));
		resourceInfo.setLength(Integer.parseInt(length));
		List<ResourceInfo> xslis = resourceInfoMapper.query(resourceInfo);
		int count = resourceInfoMapper.querySize(resourceInfo);
		Map rep = new HashMap();
		rep.put("lis", xslis);
		rep.put("size", count);
		return rep;
	}

	@Override
	public Map queryWebGJ(String startTime,String start,String length) {
		// TODO Auto-generated method stub
		WjwGj wjwGj = new WjwGj();
		wjwGj.setCreateTime(startTime);
		wjwGj.setStart(Integer.parseInt(start));
		wjwGj.setLength(Integer.parseInt(length));
		List<WjwGj> xslis = wjwGjMapper.query(wjwGj);
		int count = wjwGjMapper.querySize(wjwGj);
		Map rep = new HashMap();
		rep.put("lis", xslis);
		rep.put("size", count);
		return rep;
	}

	@Override
	public Map queryAppGJ(String startTime,String start,String length) {
		// TODO Auto-generated method stub
		WjwAppGj wjwGj = new WjwAppGj();
		wjwGj.setCreateTime(startTime);
		wjwGj.setStart(Integer.parseInt(start));
		wjwGj.setLength(Integer.parseInt(length));
		List<WjwAppGj> xslis = wjwAppGjMapper.query(wjwGj);
		int count = wjwAppGjMapper.querySize(wjwGj);
		Map rep = new HashMap();
		rep.put("lis", xslis);
		rep.put("size", count);
		return rep;
	}
}